<?php

	require "db_connection2.php";
	$q=mysql_query("SELECT
					booking_transaction.id,
					booking_transaction.trans_status,
					booking_transaction.fname,
					booking_transaction.mname,
					booking_transaction.lname,
					booking_transaction.pickupdate,
					booking_transaction.pickuptime,
					booking_transaction.droppedoffplace,
					booking_transaction.pickupplace
					FROM
					booking_transaction
					WHERE
					booking_transaction.trans_status = '$mainstatus' ");	
						
	$acc_num = 0;
	$class_alternate = "";
	while($row = mysql_fetch_array($q)){
		$acc_num=$acc_num+1;
		$lname = ucfirst($row['lname']);
		$fname = ucfirst($row['fname']);
		$mname = ucfirst($row['mname']);
		$status = $row['trans_status'];
		
			if($status == "PENDING"){ $statuscolor = "ORANGE"; }
			else if($status == "COMPLETED"){ $statuscolor = "GREEN"; }
			else { $statuscolor = "RED"; }
		
		echo"<tr class='". $class_alternate ."'>
						<td>".$acc_num."</td>
						<td><b>" .$lname. ", " .$fname. " " .$mname. "</b></td>
						<td>" .$row['pickupplace']. "</td>
						<td>" .$row['droppedoffplace']. "</td>
						<td><b>Date:</b>" .$row['pickupdate']. " <b>Time:</b> " .$row['pickuptime']. " </td>
						<td style='color:".$statuscolor.";'><b>" .$status. "</b></td>
						<td class='options-width'>";
				if ($mainstatus == "PENDING"){
					echo"<a href='" .$row['id']. "=cancel'  onclick='cancel_ride(\"".$row['id']."\");return false;' title='Cancel' class='icon-2 info-tooltip'></a>
						<a href='" .$row['id']. "=complete'  onclick='complete_ride(\"".$row['id']."\");return false;' title='Complete' class='icon-6 info-tooltip'></a>";
						}
					echo"<a href='affiliate_vehicles.php?id=" . $row['id'] . "' title='View' class='icon-5 info-tooltip' style='margin-left:10px;'</a>
						</td>
					</tr> ";
		if($class_alternate==""){ $class_alternate="alternate-row";}
		else{$class_alternate="";}				
	}
?>
